/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package name.coolwind.cxblog.service;

import name.coolwind.cxblog.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author coolwind
 */
@Service
public class UserService {
    @Autowired
    private UserDao userDao;
    
    public boolean loginCheck(String userEmail, String password){
        return userDao.hasMatchUser(userEmail, password);
    }
    
    public int getUserIdByUserEmail(String userEmail){
        return userDao.getUserByUserEmail(userEmail).getUserId();
    }
    
    public String getUserNameByUserId(String userId){
        int newUserId = Integer.valueOf(userId);
        return userDao.getUserByUserId(newUserId).getUserName();
    }
    
}
